Name: 'LoginDialog',
Extends: ModalDialog.ModalDialog,
- _init: function() {
- this.parent({ shellReactive: true, styleClass: 'login-dialog' });
+ _init: function(parentActor) {
+ this.parent({ shellReactive: true,
+ styleClass: 'login-dialog',
+ parentActor: parentActor
+ });
this.connect('destroy',
Lang.bind(this, this._onDestroy));
this.connect('opened',
GdmUtil.fadeOutActor(this._promptFingerprintMessage);
}
- _onCancel: function() {
+ cancel: function() {
this._userVerifier.cancel();
},
_showPrompt: function() {
let hold = new Batch.Hold();
- let buttons = [{ action: Lang.bind(this, this._onCancel),
+ let buttons = [{ action: Lang.bind(this, this.cancel),
label: _("Cancel"),
key: Clutter.Escape },
{ action: Lang.bind(this, function() {
const ShellDBus = imports.ui.shellDBus;
const ShellMountOperation = imports.ui.shellMountOperation;
const TelepathyClient = imports.ui.telepathyClient;
+const UnlockDialog = imports.ui.unlockDialog;
const WindowManager = imports.ui.windowManager;
const Magnifier = imports.ui.magnifier;
const XdndHandler = imports.ui.xdndHandler;
}
function createGDMSession() {
+ screenShield.showDialog();
+}
+
+function createGDMLoginDialog(parentActor) {
// We do this this here instead of at the top to prevent GDM
// related code from getting loaded in normal user sessions
const LoginDialog = imports.gdm.loginDialog;
- let loginDialog = new LoginDialog.LoginDialog();
- loginDialog.connect('loaded', function() {
- loginDialog.open();
- });
+ let loginDialog = new LoginDialog.LoginDialog(parentActor);
+ return [loginDialog, true];
+}
+
+function createSessionUnlockDialog(parentActor) {
+ let dialog = new UnlockDialog.UnlockDialog(parentActor);
+ return [dialog, false];
}
function createInitialSetupSession() {
const GnomeSession = imports.misc.gnomeSession;
const Lightbox = imports.ui.lightbox;
-const UnlockDialog = imports.ui.unlockDialog;
const Main = imports.ui.main;
const Tweener = imports.ui.tweener;
_onLockScreenKeyRelease: function(actor, event) {
if (event.get_key_symbol() == Clutter.KEY_Escape) {
- this._showUnlockDialog();
+ this._showUnlockDialog(true);
return true;
}
_onDragEnd: function(action, actor, eventX, eventY, modifiers) {
if (this._lockScreenGroup.y < -(ARROW_DRAG_TRESHOLD * global.stage.height)) {
// Complete motion automatically
- this._showUnlockDialog();
+ this._showUnlockDialog(true);
} else {
// restore the lock screen to its original place
// try to use the same speed as the normal animation
if (status == GnomeSession.PresenceStatus.IDLE) {
if (this._dialog) {
this._dialog.cancel();
- this._dialog = null;
+ if (!this._keepDialog) {
+ this._dialog = null;
+ }
}
if (!this._isModal) {
}
},
- _showUnlockDialog: function() {
- if (this._dialog)
- return;
+ showDialog: function() {
+ this.lock();
+ this._showUnlockDialog(false);
+ },
- // Tween the lock screen out of screen
- // try to use the same speed regardless of original position
- let h = global.stage.height;
- let time = CURTAIN_SLIDE_TIME * (h + this._lockScreenGroup.y) / h;
- Tweener.removeTweens(this._lockScreenGroup);
- Tweener.addTween(this._lockScreenGroup,
- { y: -h,
- time: time,
- transition: 'linear',
- onComplete: Lang.bind(this, this._hideLockScreen),
- });
-
- this._dialog = new UnlockDialog.UnlockDialog();
- this._dialog.connect('failed', Lang.bind(this, this._onUnlockFailed));
- this._dialog.connect('unlocked', Lang.bind(this, this._onUnlockSucceded));
-
- if (!this._dialog.open(global.get_current_time())) {
- log('Could not open unlock dialog: failed to acquire grab');
-
- // and then? best we can do is to autounlock, although that's potentially
- // a security issue
- this._onUnlockSucceded();
+ _showUnlockDialog: function(animate) {
+ if (animate) {
+ // Tween the lock screen out of screen
+ // try to use the same speed regardless of original position
+ let h = global.stage.height;
+ let time = CURTAIN_SLIDE_TIME * (h + this._lockScreenGroup.y) / h;
+ Tweener.removeTweens(this._lockScreenGroup);
+ Tweener.addTween(this._lockScreenGroup,
+ { y: -h,
+ time: time,
+ transition: 'linear',
+ onComplete: Lang.bind(this, this._hideLockScreen),
+ });
+ } else {
+ this._hideLockScreen();
+ }
+
+ if (!this._dialog) {
+ [this._dialog, this._keepDialog] = Main.sessionMode.createUnlockDialog(this._lockDialogGroup);
+ if (!this._dialog) {
+ // This session mode has no locking capabilities
+ this.unlock();
+ return;
+ }
+
+ this._dialog.connect('loaded', Lang.bind(this, function() {
+ if (!this._dialog.open()) {
+ log('Could not open login dialog: failed to acquire grab');
+ this.unlock();
+ }
+ }));
+
+ this._dialog.connect('failed', Lang.bind(this, this._onUnlockFailed));
+ this._dialog.connect('unlocked', Lang.bind(this, this._onUnlockSucceded));
+ }
+
+ if (this._keepDialog) {
+ // Notify the other components that even though we are showing the
+ // screenshield, we're not in a locked state
+ // (this happens for the gdm greeter)
+
+ this._isLocked = false;
+ this.emit('lock-status-changed', false);
}
},
},
unlock: function() {
+ if (this._keepDialog) {
+ // The dialog must be kept alive,
+ // so immediately go back to it
+ // This will also reset _isLocked
+ this._showUnlockDialog(false);
+ return;
+ }
+
if (this._dialog) {
this._dialog.destroy();
this._dialog = null;
hasRunDialog: false,
hasWorkspaces: false,
createSession: Main.createGDMSession,
+ createUnlockDialog: Main.createGDMLoginDialog,
extraStylesheet: null,
statusArea: {
order: [
hasRunDialog: true,
hasWorkspaces: true,
createSession: Main.createUserSession,
+ createUnlockDialog: Main.createSessionUnlockDialog,
extraStylesheet: null,
statusArea: {
order: [
this._createSession = params.createSession;
delete params.createSession;
+ this._createUnlockDialog = params.createUnlockDialog;
+ delete params.createUnlockDialog;
Lang.copyProperties(params, this);
},
createSession: function() {
if (this._createSession)
this._createSession();
- }
+ },
+
+ createUnlockDialog: function() {
+ if (this._createUnlockDialog)
+ return this._createUnlockDialog.apply(this, arguments);
+ else
+ return null;
+ },
});